<template>
  <div style="padding-top: 24px;height: 100%">
    <!-- <template v-if="type">
      <indexhome v-if="type == 'normal'" :toPath="toPath" />
      <lifeIndex v-if="type == 'life'" />
      <medicineIndex v-if="type == 'medical'" />
    </template> -->

    <indexhome :toPath="toPath" />

  </div>
</template>

<script>
import { mapGetters } from "vuex";

import { getMyInfo } from "@/api/platform/info.js";


import indexhome from "./indexhome.vue";
import medicineIndex from "./workbench/medicineIndex.vue";
import lifeIndex from "./workbench/lifeIndex.vue";



export default {
  name: "Home",
  data () {
    return {
      toPath: "",
      type: "normal",
    };
  },
  created () {
    // getMyInfo().then(response => {
    //   if (response) {
    //     if (response.data.serviceType == 'Life') {
    //       this.type = 'life'
    //     } else {
    //       this.type = 'medical'
    //     }
    //   }

    // });
  },
  computed: {
    // ...mapGetters(["roles"]),
    // role () {
    //   if (this.roles.length > 0) {
    //     if (this.roles.indexOf("doctor") > -1) {
    //       return "doctor";
    //     } else if (this.roles.indexOf("organ") > -1) {
    //       return "organ";
    //     } else if (this.roles.indexOf("cs") > -1) {
    //       return "cs";
    //     } else {
    //       return "other";
    //     }
    //   } else {
    //     return ''
    //   }

    // },
  },
  components: {
    indexhome,
    medicineIndex,
    lifeIndex
  },
  beforeRouteLeave (to, from, next) {
    this.toPath = to.path;
    next();
  },
};
</script>
